﻿using Autofac;
using Produce.Application.Services;
using System.Reflection;

namespace Produce.Api.MyAutoFac
{
    public class MyAutoFacs : Autofac.Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            var assembly = Assembly.Load("Produce.Application");

            builder.RegisterAssemblyTypes(assembly)
                .Where(x => x.Name.EndsWith("Service"))
                .AsImplementedInterfaces()
                .InstancePerLifetimeScope();


            base.Load(builder);
        }
    }
}
